{* Smarty *}
{*debug*}
<div class="title">Send Newsletter</div>
<br/><br/>
    {literal}
    <script>
    function check_lists1(a1)
    {
        return a1;
    }
    function check_lists()
    {
    for (i = 0; i < document.forms['f'].elements['receivers[]'].length; i++)
                    {
                        if (document.forms['f'].elements['receivers[]'].options[i].selected == true) return true;
                    }
    for (i = 0; i < document.forms['f'].elements['mail_groups[]'].length; i++)
                    {
                        if document.forms['f'].elements['mail_groups[]'].options[i].selected == true) return true;
                    }                
    return false;
    }                    
    </script>                
    {/literal}                
<form action="{$url}" method="POST" name="f">
<input type="hidden" name="action" value="doActionSend" />
<table cellpadding="3" cellspacing="0">
	<tr>
        <td colspan=2> Choose Receivers: <font size="1pt" color="333361"> 
        &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
         Can choose several !&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;  
         [ctrl]+[mouse click]&nbsp;&nbsp; for unselect item !</font></td>
    </tr>
	<tr>
		
		<td align="center">&nbsp;
            <div style="background-color: #ffffff; border: solid 1px #3997FF; width:111; padding: 3px;">By name</div> <br>
			<select multiple size="20" name="receivers[]" style="width:266">
                
                {foreach from=$clients item=c}
                    <option value="client|{$c.client_id}" >Client: {$c.client_name}</option>
                {/foreach}
                {section name=num loop=$user_id}
                    <option value="subscriber|{$user_id[num]}" >Subscriber: {$user_mas[num]}</option>
                {/section}
                
			
			</select>
		</td>
        <td align="center">&nbsp;
            <div style="background-color: #ffffff; border: solid 1px #3997FF; width:111; padding: 3px;">By mail group</div> <br>
            <select multiple size="20" name="mail_groups[]" style="width:266">
                {foreach from=$mail_groups item=mg}
                    <option value={$mg.group_id}> {$mg.name} </option>
                {/foreach}
            </select>
        </td>
	</tr>
        
	<tr>
		<td colspan="3" align="right">
            Choose Template: 
            <select name="template" style="width:211">
                {foreach from=$templates item=template}
                    <option value="{$template.id}" >{$template.id}.&nbsp;{$template.template_name}</option>
                {/foreach}
            </select>
            &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
            <input type="checkbox" name="send_all" value="ok" 1checked>&nbsp;&nbsp;   Send to all
            &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
            {literal}
            <input type='submit' value='Send' class="button"  onclick=" 
               if ( document.forms['f'].elements['receivers[]'].value=='' && document.forms['f'].elements['mail_groups[]'].value=='' && document.forms['f'].elements['send_all'].checked == false ) {alert('Select some receivers, please !'); return false;} "/>
              {/literal} 
		  &nbsp;<input type='button' value='Cancel' class="button" onclick="location = '{$cancel_url}';"/>&nbsp;
        </td>
	</tr>
</table>
<br><br>
</form>